package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.consumer.anno.RpcReference;
import com.lagou.rpc.pojo.User;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @RpcReference
    IUserService userService;

    /**
     * 根据id查询用户
     * @param id
     * @return
     */
    @RequestMapping("/user/{id}")
    public User findUserById(@PathVariable int id){
        return userService.getById(id);
    }
}
